package tech.aistar.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * 本类用来演示:监听application作用域的创建和销毁.
 *
 * @author: success
 * @date: 2021/4/19 8:47 上午
 */
@WebListener
public class ServletContextListenerAction implements ServletContextListener {
    /**
     * 服务器开始 - ServletContext对象被创建
     * @param sce
     */
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        System.out.println("ServletContext对象的创建..");
    }

    /**
     * 服务器关闭
     * @param sce
     */
    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        System.out.println("ServletContext对象的销毁");
    }
}
